<link rel="stylesheet" th:href="@{/lib/vertical_timeline/css/style.css}" />
<div class="ces-hgruop">
	<div class="ces-header">
		<div class="ces-cell">
			<img th:src="@{/src/img/live/robocon2015/robocondescbanner.png}" />
		</div>
		<ul class="ces-cell mid-cell">
			<li class="ces-logo"><img th:src="@{/src/img/live/robocon2015/robocongotop.png}" /></li>
			<li>第十四届全国大学生机器人大赛ROBOCON比赛</li>
			<li>2015年6月19日(星期五) - 2015年6月21日(星期天)</li>
			<br/>
			<br/>
			<li>全国高校学子代表共聚孔孟故里山东邹城，以机器人交锋辩科技探索之道，以机器人学术交流向三千年历史人文致敬</li>
			<li>本届机器人大赛的主题是“羽球双雄”，与正规羽毛球比赛规则类似，分初赛和复赛两个阶段</li>
		</ul>
		<div class="ces-cell ces-code">
			<img th:src="@{/src/img/wechatbarcode.png}" /> <span>微信扫一扫关注范客</span>
		</div>
	</div>
</div>
<section class="cd-container ces-live clearfix">
	<div class="ces-date">
		<div class="pos-fix" id="posfix">
			<div class="ces-tit">
				<div class="ces-1">
					<span>ROBOCON 2015</span>
				</div>
			</div>
            <span> <input type="radio" name="cesDate" id="cesdate3" value="21" /> <label for="cesdate3">2015-06-21</label>
            </span>
            <span> <input type="radio" name="cesDate" id="cesdate2" value="20" /> <label for="cesdate2">2015-06-20</label>
            </span>
            <span> <input type="radio" name="cesDate" id="cesdate1" value="19" /> <label for="cesdate1">2015-06-19</label>
			</span>
		</div>
	</div>
	<div class="ces-msg" id="cd-timeline">
		<div class="ces-tit">
			<div class="ces-2">
				<span>直播</span> <a href="#" class="refresh" id="refresh-live"
					th:onclick="'javascript:refresh();return false;'" title="刷新消息"><i
					class="fa fa-refresh"></i></a>
			</div>
		</div>
		<div class="cd-timeline-block" th:if="${timelines.size()>0}"
			th:each="timeline : ${timelines}">
			<div th:switch="${timeline.type}">
				<div th:case="'text'" class="cd-timeline-img cd-picture">
					<img th:src="@{/lib/vertical_timeline/img/cd-icon-location.svg}"
						alt="Location" />
				</div>
				<div th:case="'image'" class="cd-timeline-img cd-picture">
					<img th:src="@{/lib/vertical_timeline/img/cd-icon-picture.svg}"
						alt="Picture" />
				</div>
				
				<div th:case="*" class="cd-timeline-img cd-picture">
					<img th:src="@{/lib/vertical_timeline/img/cd-icon-movie.svg}"
						alt="Movie" />
				</div>
			</div>
			<div class="cd-timeline-content">
				<h2>
					<img th:src="@{/src/img/live/robocon2015/roboconavatar.png}" />范客直播君@ROBOCON2015:
				</h2>
				<div th:switch="${timeline.type}">
					<p th:case="'text'" th:text="${timeline.content}">ROBOCON2015山东邹城</p>
					<img th:case="'image'" th:src="${timeline.content}" alt="ROBOCON2015山东邹城" />
					<video th:case="*" controls="" width="430">
						<source th:src="${timeline.content}" type="video/mp4" />
						Your browser does not support HTML5 video.
					</video>
				</div>

				<a href="#0" class="cd-read-more" title="分享" id="share-panel"> <i
					class="fa fa-share-alt"></i>分享
				</a> <span class="cd-date" 
					style="display: none"
					th:text="${#dates.format(timeline.createTime, 'yyyy-MMM-dd HH:mm')}">2015-05-25</span>
				<span class="qDate"
					th:attr="data-date=${#dates.day(timeline.createTime)}"
					th:text="${#dates.year(timeline.createTime)} + '.' + ${#dates.month(timeline.createTime)} + '.' + ${#dates.day(timeline.createTime)} + ' ' + ${#dates.hour(timeline.createTime)} + ':' + ${#dates.minute(timeline.createTime)} + ':' + ${#dates.second(timeline.createTime)}">2015.05.25
					00:00:00</span>
			</div>
		</div>
	</div>
</section>
<script type="text/javascript" charset="utf-8" th:inline="javascript">
bShare
    .addEntry({
        title: " [来自范客生活的ROBOCON2015现场直播]",
        summary: "快到范客生活来看ROBOCON2015直播吧，中国最顶尖的大学生机器人比赛，尽在范客生活，跟朋友分享有更多好礼等着你哦。",
        vUid: "4905443",
        vEmail: "contact@faxsun.com",
        vTag: 'FAXSUN'
    });
</script>
<script th:src="@{/lib/vertical_timeline/js/main.js}"></script>
<script th:inline="javascript">
var checkAnyNewId;
$(document).ready(function() {
    $("#refresh-live").hide();
    //checkAnyNewId = setInterval(checkAnyNew, 30000);
});

var pathArray = window.location.pathname.split('/');
var context = pathArray[1];
var checkNewUrl = [[@{/live/robocon2015/checkAnyNew}]];

var refresh = function() {
    window.location.href = [[@{/live/robocon2015}]];
};

var checkAnyNew = function() {
    var qDate = $(".qDate").first();
    $.ajax({
        type: "POST",
        data: {
            "qDate": qDate.text()
        },
        url: checkNewUrl,
        success: function(data) {
            if (data == 'true') {
                $("#refresh-live").show();
                clearInterval(checkAnyNewId);
            } else {
                $("#refresh-live").hide();
            }
        },
        error: function(xhr, error) {
            alert(error + "-更新出错，请稍后再试");
        }
    });
}
</script>
